#include "CReader.h"
#define __CRT_SECURE_NO_WARNINGS
char* CReader::textFileRead(const char * chFileName)
{
	if (chFileName != NULL) {
		_fp = fopen(chFileName, "rt");
		if (_fp != NULL) {
			fseek(_fp, 0, SEEK_END);
			_count = ftell(_fp);
			rewind(_fp);
			if (_count > 0) {
				_content = (char*)malloc(sizeof(char) * (_count + 1));
				memset(_content, 0, (_count+1));
				_count = fread(_content, sizeof(char), _count, _fp);
				
			}
			fclose(_fp);
			//free(_content);
		}
	}
	return _content;
}

void CReader::init(void) {

	_content = NULL;
	_count = 0;
}